$(function () {
    listMould(1);
    $("body").on('click', '#btn1,#btn2', function () {
        listMould(1);
    });
    //加载模块页面数据
    function listMould(pageNo) {
        var params = $("#search-form").serializeJSON();
        params = JSON.stringify(params);
        var obj = {
            url: baseloaction + '/admin/course/mould/ajaxSelectFindMouldList',//请求URL
            contextId: 'mould-list-context',//响应内容页面设置内容ID
            params: params,//请求参数
            pageNo: pageNo,//页码
            pageCall: listMould, //分页回调加载数据(点击上下页时调用,该方法也在加载页面完成时调用)
            selectAllId: 'all-mould', //全选框ID
            callback: function () {//数据加载完成回调
                $("#count").html('(共'+total+'个模块)');
            }
        };
        ajaxGetListData(obj);
    }
});


/**
 * 获取选中模块
 */
function getSelectMould() {
    var input = $('#tbodyMaterial input.i-checks:checked');
    if(input.length==0){
        icModale(0,"请选择模块数据");
        return null;
    }
    var result = null;
    if(selectType==null || $.trim(selectType)=='' || typeof  selectType =='undefined' || selectType=='radio'){
        result = input[0];
        var _m = $(input[0]);
        var id = _m.val();
        var mouldName = _m.attr("title");
        result = {
            'id':_m.val(),
            'mouldName':mouldName
        };
    }else{
        result = new Array();
        $.each(input,function (index,_m) {
            _m = $(_m);
            var id = _m.val();
            var mouldName = _m.attr("title");
            var _mould = {
                'id':_m.val(),
                'mouldName':mouldName
            };
            result.push(_mould);
        });
    }
    return result;
}
